using System;
using UnityEngine;
using UnityEngine.UI;

namespace CGF
{
    //该脚本自动生成或覆盖，不可编辑
    public partial class LoginUI
    {   
		public CButton BtnLanguage;
		public Image Flag;
		public CButton BtnGoogle;
		public CButton BtnFacebook;
		public InputField InputPhone;
		public InputField InputUsername;
		public InputField InputPassword;
		public InputField InputEmail;
		public InputField InputCode;
		public InputField InputInviteCode;
		public CButton BtnLogin;
		public Text TextOR;
		public Text Version;
		public CButton BtnSendCode;
		public CButton TextGoReggister;
		public ImagePro SwitchBg;
		public CButton TextPhone;
		public CButton TextEmail;
		public CButton TextUsername;
		public I18N i18n;

        public Reference reference { get; private set; }
        public Action onProsBindCompleted;
        public bool isProsBindCompleted;
        
        public void BindProperties(Transform transform)
        {   
            reference = transform.GetComponent<Reference>();
            if(!reference)return;
            int nodeIndex = 0;
			BtnLanguage = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<CButton>();
			Flag = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<Image>();
			BtnGoogle = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<CButton>();
			BtnFacebook = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<CButton>();
			InputPhone = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<InputField>();
			InputUsername = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<InputField>();
			InputPassword = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<InputField>();
			InputEmail = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<InputField>();
			InputCode = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<InputField>();
			InputInviteCode = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<InputField>();
			BtnLogin = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<CButton>();
			TextOR = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<Text>();
			Version = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<Text>();
			BtnSendCode = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<CButton>();
			TextGoReggister = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<CButton>();
			SwitchBg = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<ImagePro>();
			TextPhone = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<CButton>();
			TextEmail = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<CButton>();
			TextUsername = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<CButton>();
			i18n = transform.GetComponent<I18N>();
            isProsBindCompleted = true;
            onProsBindCompleted?.Invoke();
        }
        
        public void SetProsBindCompletedAction(Action action)
        {
            if (isProsBindCompleted)
            {
                action?.Invoke();
            }
            else
            {
                onProsBindCompleted = action;
            }
        }

		public string I18N_please_input_valid_email { get { return i18n.GetTextByKey("please_input_valid_email"); } }
		public string I18N_please_input_email_code { get { return i18n.GetTextByKey("please_input_email_code"); } }
		public string I18N_please_input_valid_phone { get { return i18n.GetTextByKey("please_input_valid_phone"); } }
		public string I18N_please_input_sms_code { get { return i18n.GetTextByKey("please_input_sms_code"); } }
		public string I18N_login_fail { get { return i18n.GetTextByKey("login_fail"); } }
		public string I18N_account_not_exist { get { return i18n.GetTextByKey("account_not_exist"); } }
    }
}
